package Pattern.TemplatePattern.Program.program6;

public abstract class CarTemplate {
    protected String chassis; //汽车底盘
    protected String body; //汽车车身
    protected String paint; //喷漆
    protected String interior; //汽车内饰

    public CarTemplate() {
        super();
    }

    public abstract void fixChassis();
    public abstract void fixBody();
    public abstract void paint();
    public abstract void fixInterior();
    public void manufactureCar(){
        fixChassis();
        fixBody();
        paint();
        fixInterior();
    }

    public String getChassis() {
        return chassis;
    }

    public void setChassis(String chassis) {
        this.chassis = chassis;
    }

    public String getBody() {
        return body;
    }

    public void setBody(String body) {
        this.body = body;
    }

    public String getPaint() {
        return paint;
    }

    public void setPaint(String paint) {
        this.paint = paint;
    }

    public String getInterior() {
        return interior;
    }

    public void setInterior(String interior) {
        this.interior = interior;
    }

    @Override
    public String toString() {
        // StringBuilder class also uses Builder Design Pattern with implementation of
        // java.lang.Appendable interface
        StringBuilder builder = new StringBuilder();
        builder.append("Car [chassis=")
                .append(chassis)
                .append(",\n body=")
                .append(body)
                .append(",\n paint=")
                .append(paint)
                .append(",\n interior=")
                .append(interior)
                .append("]");
        return builder.toString();

    }
}
